luci-mod-network: show stop button if interface start is pending
authorFlorian Eckert <[email protected]>
Tue, 7 Oct 2025 12:08:11 +0000 (14:08 +0200)
committerFlorian Eckert <[email protected]>
Fri, 10 Oct 2025 12:08:27 +0000 (14:08 +0200)
Currently, it is not possible to stop an interface from establishing a
connection when it is flageed as pending in the netifd. This situation
occurs when netifd tells a proto to establish a connection, but the
proto is executing a blocken binary. This situation occurs in the proto
'modemmanager' when it wants to register but cannot. The timeout is set to
'120' seconds. During this time, the establishment cannot be stopped via
LuCI because the disable button can not be clicked.

To fix this, the pending flag is also evaluated and the disable button
is displayed in this state as well.

Signed-off-by: Florian Eckert <[email protected]>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js

index 3574115d3cb18b9ea5ec3faf38c2d563c26b93e8..fcf59e54d1d98d3bf5c73e5aab2b13be7986c494 100644 (file)
@@ -269,7 +269,8 @@ return view.extend({
                            stat = document.querySelector('[id="%s-ifc-status"]'.format(ifc.getName())),
                            resolveZone = render_ifacebox_status(box, ifc),
                            disabled = ifc ? !ifc.isUp() : true,
-                           dynamic = ifc ? ifc.isDynamic() : false;
+                           dynamic = ifc ? ifc.isDynamic() : false,
+                           pending = ifc ? ifc.isPending() : false;
 
                        if (dsc.hasAttribute('reconnect')) {
                                dom.content(dsc, E('em', _('Interface is starting...')));
@@ -317,6 +318,10 @@ return view.extend({
                                btn1.disabled = true;
                                btn2.disabled = true;
                        }
+                       else if (pending === true) {
+                               btn1.disabled = true;
+                               btn2.disabled = false;
+                       }
                        else if (disabled === true) {
                                btn1.disabled = false;
                                btn2.disabled = true;
@@ -500,7 +505,8 @@ return view.extend({
                        var tdEl = this.super('renderRowActions', [ section_id, _('Edit') ]),
                            net = this.networks.filter(function(n) { return n.getName() == section_id })[0],
                            disabled = net ? !net.isUp() : true,
-                           dynamic = net ? net.isDynamic() : false;
+                           dynamic = net ? net.isDynamic() : false,
+                           pending = net ? net.isPending() : false;
 
                        dom.content(tdEl.lastChild, [
                                E('button', {
@@ -529,6 +535,12 @@ return view.extend({
                                tdEl.lastChild.childNodes[2].disabled = true;
                                tdEl.lastChild.childNodes[3].disabled = true;
                        }
+                       else if(pending === true) {
+                               tdEl.lastChild.childNodes[0].disabled = true;
+                               tdEl.lastChild.childNodes[1].disabled = false;
+                               tdEl.lastChild.childNodes[2].disabled = false;
+                               tdEl.lastChild.childNodes[3].disabled = false;
+                       }
                        else if (disabled === true){
                                tdEl.lastChild.childNodes[0].disabled = false;
                                tdEl.lastChild.childNodes[1].disabled = true;